<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="net.groupme.gui.rendering.constants.RENDERING_CONSTANTS"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

	<title>Welcome to GroupMe! ...where Semantic Web meets Web 2.0 - [Home]</title>
	<!-- meta tags, link to css:  -->
	<%@ include file="../jsp-includes/metaheader.jsp" %>
	
	<!--  Ajax-Includes -->
    <script type='text/javascript' src='/GroupMe/dwr/interface/DWRUserManager.js'></script>
    <script type='text/javascript' src='/GroupMe/dwr/interface/DWRAdminManager.js'></script>
    <script type='text/javascript' src='/GroupMe/dwr/interface/DWRSearchManager.js'></script>
    <script type='text/javascript' src='../dwr/engine.js'></script>
	<script type='text/javascript' src='../dwr/util.js'> </script>
	<script src="../scriptaculous/prototype.js" type="text/javascript"></script>
	<script src="../scriptaculous/scriptaculous.js" type="text/javascript"></script>
    <script type="text/javascript" language="javascript">
    <!--//--><![CDATA[//><!--
     /**
      * Recomputes the User's Tag Cloud.
      */
     function computeTagCloud(){
     	$("tagCloudLoadingMessage").show();
     	DWRAdminManager.computeOverallTagCloud(computeTagCloudFinished);
     }
   		
	/**
	 * Visualize a tag cloud.
	 */
	 function computeTagCloudFinished(tagCloud){
	 	$("tagCloudLoadingMessage").hide();
	 	if(tagCloud == null || tagCloud.html == ""){
	 		$('tagcloud').innerHTML = "<i>There are not used any tags!</i>";
	 	}else{
	 		$('tagcloud').innerHTML = tagCloud.html;
	 	}
	 }
	
	//init stuff:		
	function init() {
		$("tagCloudLoadingMessage").hide();
		  DWRUtil.useLoadingMessage();
		  <c:if test="${userManager.loggedIn}">
			  //DWRUserManager.getTagCloudForUser(null, null, showTagCloud);
		  </c:if>
		}

	//--><!]]>
    </script>
</head>
<body onload="init()">
	<!-- title image, logo:  -->
	<div id="header">
		<%@ include file="../jsp-includes/titleheader.jsp" %>
	</div>
	
	<!-- Menu: -->
	<div id="menu">
		<%@ include file="../jsp-includes/menu.jsp" %>
	</div>
	<!-- content and sidebar -->
	<div id="main">

		<!-- Sidebar -->
		<div id="sidebar">
		<c:if test="${adminManager.loggedIn}">
		<p><strong>Overall Tag Cloud:</strong> </p>
			<div id="tagcloud">
				<!-- first do caching: -->
				<c:if test="${searchManager.cachedTagCloud != null}">
					<c:out value="${searchManager.cachedTagCloud.html}" escapeXml="false"/><br/>
				</c:if>
			</div>
			<span id="tagCloudLoadingMessage">
					<img src="<%= request.getContextPath() + RENDERING_CONSTANTS.RELATIVE_PATH_OF_AJAX_LOADING_IMAGE %>"/> 
					<small><i>refreshing tag cloud</i></small>
			</span>
		</c:if>
		</div>


		<!-- Content: -->
		<div id="content">
		<h1>Administration Area</h1>
		<c:choose>
			<c:when test="${adminManager.loggedIn}">
				<!-- ADMINISTRATION -->
				<h3>Tag Cloud</h3>
				<p>Recompute overall tag cloud: <a href="javascript:computeTagCloud()" onfocus="if(this.blur)this.blur()" title="Recompute tag cloud...">re-compute</a></p>
	 		</c:when>
	 		
			<c:otherwise>
 				<!-- LOGIN FIRST -->
				<p>Please login first with an admin account!
				</p>
				<p><strong>Login:</strong></p>
				<%@ include file="../jsp-includes/login.jsp" %>
			</c:otherwise>
		</c:choose>
			
		</div>
	</div>
	
	<div id="footer">
		<%@ include file="../jsp-includes/footer.jsp" %>
	</div>
</body>
</html>